home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
TextPainter.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-26
|
3KB
|
78 lines
#ifndef TextLinePainter_First
#ifdef __GNUG__
//pragma once
#pragma interface
#endif
#define TextLinePainter_First
#include "Object.h"
#include "TextStyles.h"
#include "Text.h"
//---- class TextPainter ------------------------------------------------
// paint text lines
class TextPainter: public Object {
public:
MetaDef(TextPainter);
TextPainter();
~TextPainter();
int LineWidth(Text *t, int from, int to);
void LineHeight(Text *t, LineDesc &ld, int start, int end);
virtual void Draw(Text *t, Point p, int from, int to,
Rectangle lr, Rectangle clip, bool invis= TRUE);
virtual int Map(Text *t, int from, int to, int stop, int x,
int width, int *posX);
int GetFormatWidth(Text *t, int at, int width);
int Tabulate(Text *t, int x, int at, int linestart);
private:
byte *linebuf;
byte *line;
ParaStyle *ps; // current paragraph style on a line
CharStyle *sp; // current character style on a line
int graphicChar; // graphic escape character
int nextFontChange; // position of next font change on line
bool TestFontChange(Text *t, int at, CharStyle *&sp);
bool TestVisualMark(Text *t, int at, int ch);
void Init(Text *t, int from, int to);
int Strip(Text *t, int from, int to);
int CalcSpace(Text *t, int w, int from, int to, int &space, int &blanks, int &ntab);
int CalcIndent(Text *t, ParaStyle *p, int at, int &width);
int CalcWidth(Text *t, int from, int to);
int CalcTabWidth(Text *t, ParaStyle *p, int x, int at);
int TabColWidth(Text *t, int start, char *stops);
void SetCharStyle(CharStyle *cs);
bool IsJustified(Text *t, int at);
int FirstCharPos(Text *t, int width, int start, int end);
void ShowInvisible(byte ch);
void ShowNoBreak(Point p, Rectangle clip, Text *t, int start, int end);
void ShowKeepNext(Point p, Rectangle clip, Text *t, int start, int end);
void DrawVisualMark(Point p, class VisualMark *vmp, Rectangle clip, Rectangle line, bool border);
};
//---- inlines --------------------------------------------------------------
inline bool TextPainter::TestFontChange (Text *t, int at, CharStyle *&sp)
{
if (at == nextFontChange) {
nextFontChange= t->GetNextFontChange(at, sp);
return TRUE;
}
else
return FALSE;
}
inline bool TextPainter::TestVisualMark(Text *t, int at, int ch)
{
return (graphicChar && ch == graphicChar && t->IsVisualMark(at));
}
#endif